package com.yanq.liancar.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.RelativeLayout;

import com.vondear.rxtool.RxActivityTool;
import com.yanq.liancar.R;
import com.yanq.liancar.activity.base.BaseToolbarActivity;
import com.yanq.liancar.util.Constant;
import com.yanq.liancar.util.Utils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SmallCNewsActivity extends BaseToolbarActivity {
    @BindView(R.id.rl_SystemMessage)
    RelativeLayout rlSystemMessage;
    @BindView(R.id.rl_FindMessage)
    RelativeLayout rlFindMessage;
    @BindView(R.id.rl_OrderMessage)
    RelativeLayout rlOrderMessage;

    private String where;//在哪跳转来的

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_smallcnews);
        Utils.setStatusBar(this,true,false);
        ButterKnife.bind(this);
        Bundle bundle=getIntent().getExtras();
        where=bundle.getString("where");
        if ("BHomeFragment".equals(where)){
            rlFindMessage.setVisibility(View.GONE);
        }
        mTvTitle.setText("消息");
    }

    @OnClick({R.id.rl_SystemMessage, R.id.rl_FindMessage, R.id.rl_OrderMessage})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_SystemMessage:     //系统消息
                RxActivityTool.skipActivity(mContext, SystemMessageActivity.class);
                break;
            case R.id.rl_FindMessage:
                FindMessageActivity.start(mContext);
                break;
            case R.id.rl_OrderMessage:      //订单消息
                if ("BHomeFragment".equals(where)){
                    OrderMessageActivity.start(mContext, Constant.MSG_BS);
                } else if ("HomeFragment".equals(where)) {
                    OrderMessageActivity.start(mContext, Constant.MSG_CS);
                }
                break;
        }
    }
}
